import apiService from '../../http/request'

enum LoginApi {
    GET_captcha = '/users/captcha',
    POST_login = '/users/login',
}
// 获取验证码
export const getCaptchaApi = () => {
    return apiService.get(LoginApi.GET_captcha)
}
// 登录
export const toLoginApi = (data: loginParams) => {
    return apiService.post(LoginApi.POST_login, data, {
        withCredentials: true,
    })
}

type loginParams = {
    username: string
    password: string
    captcha: string
}
